<template>
  <div class="app-container list">
    <h3>千鲸优选</h3>
    <div class="filter-container">
      <el-input class="filter-item" v-model="search" style="width: 200px" placeholder="请输入搜索内容" clearable @clear="handleClear" />
      <div><el-button size="mini" type="primary" @click="handleAdd">新增商品</el-button></div>
    </div>
      <el-table :data="list" border>
        <el-table-column type="index" label="序号" width="50px"></el-table-column>
        <el-table-column prop="id" label="图片" >
          <template slot-scope="scope">
            {{ scope.row.id }}
          </template>
        </el-table-column>
        <el-table-column prop="id" label="款式" >
          <template slot-scope="scope">
            {{ scope.row.id }}
          </template>
        </el-table-column>
        <el-table-column prop="id" label="尺寸" >
          <template slot-scope="scope">
            {{ scope.row.id }}
          </template>
        </el-table-column>
        <el-table-column prop="id" label="材质" >
          <template slot-scope="scope">
            {{ scope.row.id }}
          </template>
        </el-table-column>
      </el-table>
    <el-pagination
      v-model="page"
      :page-size="page.pageSize"
      layout="prev, pager, next"
      total="page.total"
      @pagination="getList"></el-pagination>
    <el-dialog title="商品详情" :visible.sync="productDetailsVisible">
      <product-details :pageType = 'pageType'></product-details>
    </el-dialog>
  </div>
</template>

<script>
import ProductDetails from '@/views/product/list/productDetails'
export default {
  name: 'Index',
  components: { ProductDetails },
  data() {
    return {
      search: '',
      page: {
        page: 1,
        pageSize: 10,
        total: 0
      },
      productDetailsVisible: false,
      pageType: 1
    }
  },
  created() {
    this.getList()
  },
  methods: {
    handleAdd() {
      this.productDetailsVisible = true
    },
    handleClear() {
      this.search = ''
    },
    getList() {
      getProductList().then(res => {
        console.log(res)
      })
    }
  }
}
</script>

<style scoped>

</style>
